<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
	<head>
	<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/sectionparent.css" source="widget" />
	<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/apply.css" source="widget" />	
	<script src="${ctx}/js/controllers/adinfo/AdApplyController.js" type="text/javascript"></script>
	</head>
	<body>
	<div style="top:130px;position:fixed;height:30px;font-size: 14px;font-family: '微软雅黑';margin-left:-236px;">
				当前位置：${sessionScope.currcent_position}
          </div>
          <section>
                 <div class="panel panel-default" style="margin-top:16px;">
                  <div class="forword_area"></div>
					<div class="location">添加广告位</div>
					</div>

                		<div id="form" class="form" style="min-height:550px;border: 1px solid #e6e6e6;">
								    <div class="itemEdit"">
								        <input id="infoadCategoryid" type="hidden" value="${adInfo.adCategoryId }">
		                                <span class="col-sm-1 editlableDetail" style="font-size:14px;"><em class="emStyle">*</em>广告位类型：</span>
		                                <div class="fldetail-4l" >
		                                <select id="adCategoryid"  onblur="checkAdCategoryType()"  style="height: 29px;width: 70%; margin-left: -30px;margin-top: -4px" required>
		                                <option value=''>请选择广告位类型</option>
			                             <c:forEach items="${adCategorys}" var="item" varStatus="cStatus">
										 <option value="${item.id}"  <c:if test="${item.id == adCategoryId}">selected="selected"</c:if>>${item.name}</option>
								        </c:forEach>
		                                </select>
		                              </div>
									 <span class="col-sm-1 editlableDetail" style="font-size:14px;margin-left:70px"><em class="emStyle">*</em>标题：</span>
		                               <div class="fldetail-4r">
		                               <input id="adInfoId" type="hidden" value="${adInfo.id}">
		                               <input class="controlEdit" id="title" onblur="checkTitle()" style="width:100%;margin-left: -81px;"  type="text" value="${adInfo.title}" >
		                              </div>
		                            </div> 
		                            <div class="itemEdit" style="padding-top:10px;">
										<span class="col-sm-1 editlableDetail" style="font-size:14px;"><em class="emStyle">*</em>广告有效期：</span>
										<div class="fldetail-4l" >
											 <input class="controlEdit" style="width:41%;margin-left:-40px" id="beginTime" type="text" maxlength="11" class="input-sm" 
											 onblur="checkBeginTime()"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'#F{$dp.$D(\'endTime\')}'})" 
											 value="${adInfo.beginTime}">
										     <span style="margin-left:3px;margin-right:3px;font-family: 微软雅黑;font-size: 14px;">至</span>
											 <input class="controlEdit" style="width:41%" id="endTime" type="text" maxlength="11" class="input-sm" 
											 onblur="checkEndTime()"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'beginTime\')}',startDate:'#F{$dp.$D(\'beginTime\',{d:+1})}'})" 
											 value="${adInfo.endTime}">
										</div>
										<span class="col-sm-1 editlableDetail" style="font-size:14px;margin-left: 40px;">备注说明：</span>
										<div class="fldetail-4r" >
											 <input class="controlEdit" id="remark" style="width:99%;margin-left:-48px"  type="text" maxlength="50" value="${adInfo.remark}">
										</div>
									</div>
									 <div  class="itemEdit" style="height:220px;padding-top:20px;padding-left: 75px;">
										<input id="imageLogo" type="hidden" value="${adInfo.img }">
										<span class="col-sm-1 editlableDetail" style="font-size:14px;">广告图片：</span>
										<div class="flEditMap">
										
											<c:if test="${adInfo.img == null || adInfo.img == ''}">
													<img id="preview3" style="width:150px;height:150px;float:left;margin-left:-20px" title="快上传广告图片吧" src="${ctx}/images/seller/ad/ad_default.png" />
											</c:if>
											<c:if test="${adInfo.img != null && adInfo.img != ''}">
												<img id="preview3" style="width:150px;height:150px;float:left;margin-left:-15px" src="${sessionScope.image_logo}${adInfo.img}" />
											</c:if>
											<div class="mtjxsa" style="float:left;margin-top: 40px;margin-left:20px;">
								  <p style="text-align: left;margin-left:-20px" id="imageBtn">
									  <input type="hidden" name="imageLogoUrl" id="imageLogoUrl" />
									  <img style="margin-left:23px;margin-top: -5px;" src="${ctx}/images/seller/goods/tip.png"/>
									  <span style="color:#262535;font-size:14px;">提示：只能上传.jpg, .png的图片格式,照片文件大小最大为10MB</span>
								  </p>
								  <div>
							    	  <div class="fl">
							    		  <button style="width:100px;height:30px;background-color: #F9C771;border-radius: 4px;color: #fff;margin-top: 10px;border: 0px;font-size:14px;font-weight:700;" class="acblu tctpsc">上传广告图片</button>
							          </div>
							      </div>
							  </div>
											<%@include file="/views/common/uploader/picture.jsp" %>
										</div>
									</div>
									<div class="itemEdit">
		                               <span class="col-sm-1 editlableDetail" style="font-size:14px;"><em class="emStyle">*</em>对象类型：</span>
										<div class="fldetail-4l" >
										<select id="objType" onblur="checkObjType()" onchange="selectChange()" style="height: 29px;width: 70%; margin-left: -45px;margin-top: -4px" required>
		                                <option  value="" selected="selected">请选择对象类型</option>
										 <option value="1">店铺</option>
										 <option value="2">商品</option>
										 <option value="3">特殊网页</option>
		                                </select>
										</div>
										<input type="hidden" id="shopId" value="${sessionScope.shop_id.id}"/>
										<span class="col-sm-1 editlableDetail" id="objContent1" style="font-size:14px;display:none;margin-left: 70px;"><em class="emStyle">*</em>请选择商品：</span>
										<div class="fldetail-4r" id="objC1" style="display:none">
										<select id="goodsId"  onblur="checkGoods()"  style="height: 29px;width: 70%; margin-left: -30px;margin-top: -4px" required>
		                                <option value=''>请选择商品</option>
			                             <c:forEach items="${goodsInfos}"
			                              var="item" varStatus="cStatus">
										 <option value="${item.id}">${item.name}</option>
								        </c:forEach>
		                                </select>
										</div>
										<span class="col-sm-1 editlableDetail" id="objContent2" style="font-size:14px;display:none;margin-left: 70px;"><em class="emStyle">*</em>网页地址：</span>
										<div class="fldetail-4r" id="objC2" style="display:none">
											<input class="controlEdit" id="webUrl"  onblur="checkURL()" style="width:85%;margin-left:-52px;"  type="text" maxlength="50" value="${adInfo.url}"> 
										</div>
									</div>
									
					</div>
							<div class="foot">
							<div ">
								<div style="float:left;padding-left:40%;padding-top:19px">
									<button class="buttonEdit" onclick="saveAdInfo();">添&nbsp;&nbsp;加</button>
								</div>
								<div style="float:left;margin-left:2%;padding-top:19px">
									<button class="buttonCancle" onclick="cancel();">取&nbsp;&nbsp;消</button>
								</div>
								</div>
							</div>
				
              </section>
         </body>
		<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
		function selectChange(){
			if($("#objType option:selected").val()==""){
				$("#objContent1").hide();
				$("#objC1").hide();
				$("#objContent2").hide();
				$("#objC2").hide();
			}
			if($("#objType option:selected").val()==1){
				$("#objContent1").hide();
				$("#objC1").hide();
				$("#objContent2").hide();
				$("#objC2").hide();
			}
			if($("#objType option:selected").val()==2){
				$("#objContent1").show();
				$("#objC1").show();
				$("#objContent2").hide();
				$("#objC2").hide();
				//alert($("#goodsId option:selected").text());
			}
			if($("#objType option:selected").val()==3){
				$("#objContent2").show();
				$("#objC2").show();
				$("#objContent1").hide();
				$("#objC1").hide();
			}
		}
		
	</script>
	
	<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
	<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
